package com.yc.happ.serviceImpl;

import java.util.ArrayList;
import java.util.List;

import com.yc.happ.service.RegisterService;
import com.yc.happ.util.DBHelper;

public class RegisterServiceImpl implements RegisterService{

	@Override
	public boolean volunteerRegister(String vuname, String vpassword, String vsex, String vaddress, String vtype) {
		String sql="insert into volunteer(vid,vuname,vpassword,vsex,vtype,vaddress,vscore,isChoose) values(vid,?,?,?,?,?,0,0);";
		List<Object> params=new ArrayList<Object>();
		params.add(0,vuname);
		params.add(1,vpassword);
		params.add(2,vsex);
		params.add(3,vtype);
		params.add(4,vaddress);
		int i=DBHelper.doUpdate(sql, params);
		if(i>0){
			return true;
		}else{
			return false;
		}
	}

	@Override
	public boolean elderRegiter(String vuname, String vpassword, String vsex, String vaddress, String vaddress3) {
		String sql="insert into elder(vid,vuname,vpassword,vsex,vaddress,vaddress3,isChoose) values(vid,?,?,?,?,?,0);";
		List<Object> params=new ArrayList<Object>();
		params.add(0, vuname);
		params.add(1, vpassword);
		params.add(2, vsex);
		params.add(3, vaddress);
		params.add(4,vaddress3);
		int i=DBHelper.doUpdate(sql, params);
		if(i>0){
			return true;
		}else{
			return false;
		}
	}
	
}
